﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;

public partial class admin_Airports : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        LoadData();
        Utilities.SetLabel(Master, "Places");
    }

    private void LoadData()
    {
        using (SqlConnection conn = new SqlConnection(DAO.Connection.CONN_STRING1))
        {
            conn.Open();
            using (SqlCommand cmd = new SqlCommand("SELECT * from dbo.Fn_GetAllPlaces(0, 100000, 'id', 'asc', 2)", conn))
            {
                SqlDataReader dr = null;
                dr = cmd.ExecuteReader();
                if (dr != null)
                {
                    if (dr.HasRows)
                    {
                        ddl_country.Items.Add(new ListItem("Please Select Country", "0"));
                        while (dr.Read())
                        {
                            ddl_country.Items.Add(new ListItem(dr["name"].ToString(), dr["id"].ToString()));
                        }
                    }
                }
                dr.Close();
            }
        }
    }
}
